package com.kingbook.core.executor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.ResultSetExtractor;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Author: Bucky
 * @Date: 2019/1/2
 * @Version 1.0
 */
class SQLCountResultSetExtractor implements ResultSetExtractor<Integer> {

    private static Logger logger = LoggerFactory.getLogger(SQLCountResultSetExtractor.class);

    @Override
    public Integer extractData(ResultSet rs) throws SQLException {
        if (rs.next())
            return rs.getInt(1);
        return 0;
    }

}
